package com.example.hello.service.controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.example.hello.service.model.Book;

@RestController
public class BookController {

	/**
	 * get请求
	 * 
	 * @param name
	 * @return
	 */
	@RequestMapping(value = "/getbookbyname", method = RequestMethod.GET)
	public Book getBookByName(String name) {
		Book book = new Book();
		book.setName(name);
		System.out.println("获取书籍信息：书名：" + name);
		return book;
	}

	/**
	 * post请求
	 * 
	 * @param name
	 * @return
	 */
	@RequestMapping(value = "/postbookbyname", method = RequestMethod.POST)
	public Book postBookByName(@RequestBody String name) {
		Book book = new Book();
		book.setName(name);
		return book;
	}

}
